<html>
<head><meta charset="utf-8"><title>Should various const checking things actually be in wf-ch... · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html">Should various const checking things actually be in wf-ch...</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246840899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246840899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246840899">(Jul 22 2021 at 12:42)</a>:</h4>
<p>const checking starts looking more and more similar to things from wf-checking. We should evaluate whether it actually belongs into wf-check</p>



<a name="246953562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246953562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246953562">(Jul 23 2021 at 08:43)</a>:</h4>
<p>Any examples you are thinking of here?<br>
his could relate to a concern I shared a few months ago that const-checking does 2 jobs:</p>
<ul>
<li>for some unstable features, check the feature gate</li>
<li>for some things that can never be allowed in <code>const</code> (or at least seems extremely unclear), reject them without offering a feature gate to suppress the check</li>
</ul>



<a name="246953613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246953613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246953613">(Jul 23 2021 at 08:44)</a>:</h4>
<p>also the code calls it "const validation", but I also prefer "const checking" so maybe we should finally rename the files? :D</p>



<a name="246961702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246961702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246961702">(Jul 23 2021 at 10:27)</a>:</h4>
<p>The main thing I am thinking about is the check for calling functions. We need to know about the bounds in scope and check that they are <code>const</code> where the called function requires that</p>



<a name="246961797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246961797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246961797">(Jul 23 2021 at 10:28)</a>:</h4>
<p>we do some checks that check whether we only call <code>const fn</code> from const contexts, but that seems to me to be very similar to checking if calling a generic function from a generic function is possible with the trait bounds in scope</p>



<a name="246964879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246964879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246964879">(Jul 23 2021 at 11:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E/near/246961797">said</a>:</p>
<blockquote>
<p>we do some checks that check whether we only call <code>const fn</code> from const contexts, but that seems to me to be very similar to checking if calling a generic function from a generic function is possible with the trait bounds in scope</p>
</blockquote>
<p>ah I see. yes that makes sense.</p>



<a name="246964963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246964963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246964963">(Jul 23 2021 at 11:14)</a>:</h4>
<p>independently of that, what do you think of renaming <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/check_consts/validation.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir/src/transform/check_consts/validation.rs</a> to <code>check.rs</code> or so? then "validation" is less overloaded (with the value validation in <code>interpret</code>)</p>



<a name="246967779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Should%20various%20const%20checking%20things%20actually%20be%20in%20wf-ch.../near/246967779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Should.20various.20const.20checking.20things.20actually.20be.20in.20wf-ch.2E.2E.2E.html#246967779">(Jul 23 2021 at 11:52)</a>:</h4>
<p>yes, that is a good renaming</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>